<?php
	session_start();

	if($_SESSION['user']){
	}
	else{
		header("location:index.php");
	}

	if($_SERVER['REQUEST_METHOD'] = "POST") //Added an if to keep the page secured
	{
		$description = mysql_real_escape_string($_POST['description']);
		//$time = strftime("%X");//time
		$date = mysql_real_escape_string($_POST['date']);
		$type = mysql_real_escape_string($_POST['type']);
		$name = "test";
		$hasResult = "N";
		$location = "LCDTH";
		$username = "choto";
		//if ($username == null){
		//	$username="R2D2";
		//}

		mysql_connect("localhost", "root","admin") or die(mysql_error()); //Connect to server
		mysql_select_db("InfMedicas") or die("Cannot connect to database"); //Connect to database //Connect to database
		echo $description;
		echo $name;
		echo $hasResult;
		echo $location;
		echo $type;
		echo $date;

		mysql_query("INSERT INTO picture (description, name, hasResult, location,type,meal_date) VALUES ("negro","CONCHUDO","M","puto","del","orto");"); //SQL query
		//header("location: home.php");
		echo "successfulllllllll";
	}
	else
	{
		header("location:home.php"); //redirects back to hom
	}
?>